/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Network;

import java.io.IOException;
import java.net.SocketException;
import org.apache.commons.net.ftp.FTPClient;
import Network.INetwork;

/**
 *
 * @author Alex
 */
public class FTP implements INetwork{
    
    private String m_User;
    private String m_Password;
    private String m_ServerPath;
    FTPClient ftpClient;
    
    public FTP()
    {
        init();
    }
    
        
    public boolean login()
    {
        boolean isLoginSuccess = true;
        
        try {
            ftpClient.connect(m_ServerPath);
            
            if (!ftpClient.login(m_User, m_Password))
            {
                isLoginSuccess = false;
            }
        }catch(SocketException socketEx){
            socketEx.printStackTrace();
        }catch(IOException ioEx){
            ioEx.printStackTrace();
        }finally{
            try{
            ftpClient.disconnect();
        }catch(IOException ioEx){
                ioEx.printStackTrace();
            }
        }
        return isLoginSuccess;
    }
    

    @Override
    public void init() {
        // Modify here
    }

    @Override
    public boolean connect() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean disconnect() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean isConnected() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean upload() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean download() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    
    
    
    
}
